package org.dromara.comm_lhz.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.dromara.comm_lhz.entity.AsAddressEntity;
import org.dromara.comm_lhz.service.AsAddressService;

import org.springdoc.core.converters.models.Pageable;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 地址表控制层
 *
 * @author makejava
 * @since 2024-08-11 21:58:39
 */
@RestController
@RequestMapping("/asAddress")
@Tag(name = "地址表")
public class AsAddressController  {
    /**
     * 服务对象
     */
    @Resource
    private AsAddressService asAddressService;

    /**
     * 通过区域或社区名模糊查询单条数据
     *
     * @param asAddressEntity
     * @return
     */
    @PostMapping("/getAddress")
    public Map<String, Object> getAddress(@RequestBody AsAddressEntity asAddressEntity){
        return asAddressService.getAddress(asAddressEntity);
    }

    /**
     * 新增数据
     * @param asAddressEntity
     */
    @PostMapping("/addAddress")
    public void addAddress(@RequestBody AsAddressEntity asAddressEntity){
        asAddressService.save(asAddressEntity);
    }
    /**
     * 修改数据
     *
     * @param asAddressEntity
     * @return 修改结果
     */
    @PostMapping("/updateAddress")
    public void updateAddress(@RequestBody AsAddressEntity asAddressEntity){
        asAddressService.updateById(asAddressEntity);
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("/deleteAddress")
    public void deleteAddress(Long id){
        asAddressService.removeById(id);
    }



}

